﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using WoChu.RfClient.Duty.IFace;
using WoChu.RfClient.Entity;

namespace WoChu.RfClient.Duty
{

    public class OffShelvesOrderWCUIRule:IOffShelvesOrderWC
    {
        private static OffShelvesOrderWCUIRule _NewInstance = new OffShelvesOrderWCUIRule();

        public static OffShelvesOrderWCUIRule NewInstance
        {
            get
            {
                if (_NewInstance == null)
                {
                    _NewInstance = new OffShelvesOrderWCUIRule();
                }

                return _NewInstance;
            }
        }

        #region IOffShelvesOrderWC 成员

        public WoChu.RfClient.Entity.ResultModel<OffShelvesInfo> CheckGoodsLocationInfo(string gdcode)
        {
            try
            {
                ResultModel<OffShelvesInfo> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOffShelvesOrderWC>.NewInstance.InvokeWebMethod<ResultModel<OffShelvesInfo>>("CheckGoodsLocationInfo", new object[] { gdcode });
                if (_result == null)
                    return new ResultModel<OffShelvesInfo>().GetInstance();         
                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return null;
            }
        }

        public WoChu.RfClient.Entity.ResultModel<bool> SetOffShelvesWC(string userID, List<OffShelvesInfo> lstOffShelves)
        {
            try
            {
                ResultModel<bool> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOffShelvesOrderWC>.NewInstance.InvokeWebMethod<List<OffShelvesInfo>, ResultModel<bool>>("SetOffShelvesWC", new object[] { userID }, lstOffShelves);
                if (_result == null)
                    return new ResultModel<bool>().GetInstance();
                return _result;

            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return new ResultModel<bool>().GetInstance();
            }
        }
 
        public ResultModel<List<OffShelvesInfo>> GetOffShelvesListWC(string batchNo,DateTime offShelvesDate,string cellno)
        {
            try
            {
                ResultModel<List<OffShelvesInfo>> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOffShelvesOrderWC>.NewInstance.InvokeWebMethod<ResultModel<List<OffShelvesInfo>>>("GetOffShelvesListWC", new object[] { batchNo, offShelvesDate, cellno });
                if (_result == null)
                    return new ResultModel<List<OffShelvesInfo>>().GetInstance();
                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return new ResultModel<List<OffShelvesInfo>>().GetInstance();
            }

        }

        public ResultModel<List<OffShelvesInfo>> GetCellnoListWC()
        {
            try
            {
                ResultModel<List<OffShelvesInfo>> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOffShelvesOrderWC>.NewInstance.InvokeWebMethod<ResultModel<List<OffShelvesInfo>>>("GetCellnoListWC", new object[] { });
                if (_result == null)
                    return new ResultModel<List<OffShelvesInfo>>().GetInstance();
                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return new ResultModel<List<OffShelvesInfo>>().GetInstance();
            }
        }

        #endregion
    }
}
